package com.lyq.mr.homework.plantwo;


import org.apache.hadoop.io.WritableComparable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public class NumSortBeen implements WritableComparable<NumSortBeen> {
    private int num;


    public NumSortBeen() {
    }

    public NumSortBeen(int num) {
        this.num = num;
    }

    @Override
    public int compareTo(NumSortBeen o) {

        int result =this.num-o.num;
        if(result == 0){
            return this.num - o.num;
        }
        return result;
    }



    @Override
    public void write(DataOutput out) throws IOException {
        out.writeInt(num);
    }

    @Override
    public void readFields(DataInput in) throws IOException {
            this.num=in.readInt();
    }

    public int getNum() {
        return num;
    }

    public void setNum(int num) {
        this.num = num;
    }

    @Override
    public String toString() {
        return num +"";

    }
}
